package com.butuh.uang.tuh.ang.util;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.util.Log;
import android.widget.Toast;

import com.facebook.CallbackManager;
import com.facebook.FacebookCallback;
import com.facebook.share.model.ShareLinkContent;
import com.facebook.share.widget.ShareDialog;

public class ShatsAppShareUtils {

    private static String whatsappPageName = "com.whatsapp";

    /**
     * 分享
     */
    public static void share(Context context, String Url) {
        if (DownLoadUtil.checkAppInstalled(context, whatsappPageName)) {//判断手机是否安装了该软件
            try {
                Intent vIt = new Intent();
                vIt.setAction(Intent.ACTION_SEND);
                vIt.setPackage(whatsappPageName);
                vIt.setType("text/plain");
                Uri url = Uri.parse(Url);  //path为json解析的路径
                vIt.putExtra(Intent.EXTRA_TEXT, " " + url);
                context.startActivity(vIt);
            } catch (Exception ex) {
                Log.e("===", "whatsAppShare:" + ex);
            }
        } else {
            Toast.makeText(context, "No apps are installed on your phone", Toast.LENGTH_SHORT).show();
        }
    }

}
